package flc.ast.adapter;


import android.view.View;
import android.widget.ImageView;

import androidx.annotation.NonNull;

import com.blankj.utilcode.util.ConvertUtils;
import com.blankj.utilcode.util.FileUtils;
import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import flc.ast.bean.MyAlbumBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;
import stark.common.basic.utils.FileP2pUtil;

public class VideoCategoryAdapter extends StkProviderMultiAdapter<MyAlbumBean> {


    public VideoCategoryAdapter() {
        addItemProvider(new StkSingleSpanProvider(126));
        addItemProvider(new VideoCategoryProvider());
    }

    private class VideoCategoryProvider extends BaseItemProvider<MyAlbumBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_video_category;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, MyAlbumBean bean) {
            baseViewHolder.setText(R.id.tvVideoCategoryItemName, bean.getName());
            int num = bean.getListData().size();
            long size = 0;
            for (String listDatum : bean.getListData()) {
                size += FileUtils.getFileLength(listDatum);
            }
            baseViewHolder.setText(R.id.tvVideoCategoryItemNum, getContext().getString(R.string.video_num, num, ConvertUtils.byte2FitMemorySize(size, 1)));
        }
    }

}
